# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qtsvg
pkgver=5.15.5_git20220617
pkgrel=0
_commit="68de925ddc20dfb8900be4fa47fa5a5916836cc8"
pkgdesc="Qt5 - Support for rendering and displaying SVG"
url="https://www.qt.io/developers/"
arch="all"
license="(LGPL-2.0-or-later OR GPL-3.0-only OR GPL-2.0-or-later) AND Qt-GPL-exception-1.0"
makedepends="
	qt5-qtbase-dev
	zlib-dev
	"
subpackages="$pkgname-dev"
builddir="$srcdir/qtsvg-$_commit"

case $pkgver in
	*_beta*|*_rc*) _rel=development_releases;;
	*) _rel=official_releases;;
esac

source="https://invent.kde.org/qt/qt/qtsvg/-/archive/$_commit/qtsvg-$_commit.tar.gz"

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	# Drop QMAKE_PRL_BUILD_DIR because reference the build dir
	find "$pkgdir/usr/lib" -type f -name '*.prl' \
		-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

	install -d "$pkgdir"/usr/share/licenses
	ln -s /usr/share/licenses/qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
d4965cb2f8ed7bd0bd1f2d88a203d6704539604ee4190169eebd6fd5afd822332ea88e539f0cc4ed558f810532e8591590bd38c7d8e432525b815fe1a15e684b  qtsvg-68de925ddc20dfb8900be4fa47fa5a5916836cc8.tar.gz
"
